package com.htc.android.footprints.commonui;

import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

public class ListItemDialog extends Dialog
{
  private static final String TAG = "ListItemDialog";
  public int[] mIconList;
  public String[] mItemList;
  ListView mListView;

  public ListItemDialog(Context paramContext, String paramString, int paramInt)
  {
    super(paramContext);
    getWindow().setBackgroundDrawable(new ColorDrawable());
    getWindow().requestFeature(1);
    setContentView(2130903061);
    ImageView localImageView = (ImageView)findViewById(2131492980);
    TextView localTextView = (TextView)findViewById(2131492981);
    this.mListView = ((ListView)findViewById(2131492982));
    if (paramInt == 0)
    {
      localImageView.setVisibility(8);
      if (paramString != null)
        break label120;
      localTextView.setVisibility(8);
    }
    while (true)
    {
      return;
      Drawable localDrawable = getContext().getResources().getDrawable(paramInt);
      if (localDrawable == null)
        break;
      localImageView.setImageDrawable(localDrawable);
      break;
      label120: localTextView.setText(paramString);
    }
  }

  private boolean isResolutionQVGA()
  {
    if (((WindowManager)getContext().getSystemService("window")).getDefaultDisplay().getHeight() <= 320);
    for (int i = 1; ; i = 0)
      return i;
  }

  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    Log.i("ListItemDialog", "keyCode = " + paramInt);
    if (paramInt == 4)
      dismiss();
    return super.onKeyDown(paramInt, paramKeyEvent);
  }

  public void setListItem(String[] paramArrayOfString, int[] paramArrayOfInt)
  {
    this.mItemList = paramArrayOfString;
    this.mIconList = paramArrayOfInt;
    this.mListView.setAdapter(new ItemListAdapter());
  }

  public void setOnItemClickListener(AdapterView.OnItemClickListener paramOnItemClickListener)
  {
    this.mListView.setOnItemClickListener(paramOnItemClickListener);
  }

  private class DialogListItem extends LinearLayout
  {
    private int ITEM_HEIGHT = 48;
    private ImageView mItemIcon;
    private TextView mItemText;
    private ViewGroup mLayout;

    public DialogListItem(Context paramString, String paramDrawable, Drawable arg4)
    {
      super();
      setOrientation(1);
      if (ListItemDialog.this.isResolutionQVGA())
        this.ITEM_HEIGHT = 34;
      this.mLayout = ((ViewGroup)((LayoutInflater)getContext().getSystemService("layout_inflater")).inflate(2130903060, null));
      addView(this.mLayout, -2, this.ITEM_HEIGHT);
      this.mItemIcon = ((ImageView)findViewById(2131492978));
      this.mItemText = ((TextView)findViewById(2131492979));
      Drawable localDrawable;
      if (localDrawable != null)
        this.mItemIcon.setImageDrawable(localDrawable);
      while (true)
      {
        if (paramDrawable != null)
          this.mItemText.setText(paramDrawable);
        return;
        this.mItemIcon.setVisibility(8);
      }
    }

    public void setText(String paramString)
    {
      this.mItemText.setText(paramString);
    }
  }

  private class ItemListAdapter extends BaseAdapter
  {
    public ItemListAdapter()
    {
    }

    public int getCount()
    {
      return ListItemDialog.this.mItemList.length;
    }

    public Object getItem(int paramInt)
    {
      return Integer.valueOf(paramInt);
    }

    public long getItemId(int paramInt)
    {
      return paramInt;
    }

    public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
    {
      ListItemDialog.DialogListItem localDialogListItem;
      if (paramView == null)
        if (ListItemDialog.this.mIconList == null)
          localDialogListItem = new ListItemDialog.DialogListItem(ListItemDialog.this, ListItemDialog.this.getContext(), ListItemDialog.this.mItemList[paramInt], null);
      while (true)
      {
        return localDialogListItem;
        int i = ListItemDialog.this.mIconList[paramInt];
        Drawable localDrawable = ListItemDialog.this.getContext().getResources().getDrawable(i);
        localDialogListItem = new ListItemDialog.DialogListItem(ListItemDialog.this, ListItemDialog.this.getContext(), ListItemDialog.this.mItemList[paramInt], localDrawable);
        continue;
        localDialogListItem = (ListItemDialog.DialogListItem)paramView;
        localDialogListItem.setText(ListItemDialog.this.mItemList[paramInt]);
      }
    }
  }
}

/* Location:           E:\workspace\dex2java\dex-translator-0.0.9.3\HtcFootprints_dex2jar.jar
 * Qualified Name:     com.htc.android.footprints.commonui.ListItemDialog
 * JD-Core Version:    0.6.0
 */